package control;

import java.util.Collection;

import view.ElementWrapper;
import view.Map;

public class WrapperTicker extends Ticker<ElementWrapper>{
	private Map map;
	public WrapperTicker(Map map){
		this.map = map;
	}
	
	@Override
	public synchronized boolean addAll(Collection<? extends ElementWrapper> toAdd){
		for(ElementWrapper ew : (Collection<ElementWrapper>)toAdd){	
			map.add(ew, ew.getDepth());
		}
		return super.addAll(toAdd);
	}
	
	@Override
	public synchronized boolean removeAll(Collection<?> toRemove){
		for(ElementWrapper ew : (Collection<ElementWrapper>)toRemove){	
			map.remove(ew);
		}
		return super.removeAll(toRemove);
	}

}